<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<base href="${base}/manager/" />
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
</head>
<script src="js/jquery-3.5.0.js"></script>
<script src="layer/layer.js"></script>
<script>
	function del(id,name) {
		layer.confirm('您确定删除吗？', {
			btn : [ '确定', '取消' ]
		//按钮
		},function() {
			location.href = "CateGoryServelet?opr=del&id=" + id+"&name="+name;
		} , function() {
			return;
		})
	}
	
	function toAdd(){
		location.href="category/category_add.jsp";
	}
	window.addEventListener("load",function(){
		let msg = "${msg}";
		if(msg!=""){
			layer.msg(msg);
		}
		let success = "${success}";
		if(success!=""){
			layer.msg(success);
		}
	})
	
</script>
<body>
	<form method="post" action="">
		<div class="panel admin-panel">
			<div class="panel-head">
				<strong class="icon-reorder">商品类别列表</strong>
			</div>
			<div class="padding border-bottom">
				<button type="button" class="button border-yellow" onclick="toAdd()">
					<span class="icon-plus-square-o"></span>增加商品类别
				</button>
			</div>
			<table class="table table-hover text-center">
				<tr>
					<th>序号</th>
					<th>商品类别名称</th>
					<th>状态</th>
					<th>操作</th>
				</tr>
				<c:forEach items="${categories}" var="category" varStatus="s">
					<tr>
						<td>${s.count}</td>
						<td>${category.name}</td>
						<td>${category.status}</td>
						<td>
							<div class="button-group">


								<a class="button border-main"
									href="CateGoryServelet?opr=initUpdate&id=${category.id}"><span
									class="icon-edit"></span> 修改</a> <a class="button border-red"
									href="javascript:void(0)" onclick="del('${category.id}','${category.name}')"><span
									class="icon-trash-o"></span> 删除</a>
							</div>
						</td>
					</tr>
				</c:forEach>
			</table>
		</div>
	</form>
</body>
</html>